package com.umpay.privi.dao.on.sys.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.umpay.common.persist.AbstractDao;
import com.umpay.common.persist.ibatis.DataAccessException;
import com.umpay.common.persist.ibatis.exception.SQLErrorCodeSQLExceptionTranslator;
import com.umpay.privi.dao.EntityDaoImpl;
import com.umpay.privi.dao.on.sys.UserRoleDao;
import com.umpay.privi.model.sys.UserRole;

/** 
 * desc:用户角色关联关系Dao实现类
 * <p>创建人：Ding Zhe 创建日期：May 6, 2013 </p>
 * @version V1.0  
 */
@SuppressWarnings("unchecked")
public class UserRoleDaoImpl extends EntityDaoImpl<UserRole> implements UserRoleDao {
	public Integer update(Map<String, Object> qryMap) throws DataAccessException{
		try {
			return (Integer)getSqlMapClientTemplate().getSqlMapClient().update("UserRole.Update", qryMap);
		} catch (SQLException e) {
			throw new SQLErrorCodeSQLExceptionTranslator(AbstractDao.DB_TYPE_DB2).translate(e.getMessage(), e);
		}
	}
	
	public List<Map<String, Object>> queryUserRolesByUserId(Map<String, Object> qryMap) throws DataAccessException {
		try {
			return (List<Map<String, Object>>)getSqlMapClientTemplate().getSqlMapClient().queryForList("UserRole.queryUserRolesByUserId", qryMap);
		} catch (SQLException e) {
			throw new SQLErrorCodeSQLExceptionTranslator(AbstractDao.DB_TYPE_DB2).translate(e.getMessage(), e);
		}
	}
}



